package book.servlet;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import book.entity.Category;
import book.service.BookService;
import book.service.CategoryService;
import book.service.impl.BookServiceImpl;
import book.service.impl.CategoryServiceImpl;

/**
 *            
 */
public class BookAddJumpServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

    CategoryService categoryService = new CategoryServiceImpl();
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
		doPost(request, response);
		
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		try {
			
			
			List<Category> categoryList = categoryService.getCategoryList();
			
			System.out.println(categoryList);
			request.setAttribute("categoryList", categoryList);
			
			request.getRequestDispatcher("/book_add.jsp").forward(request, response);
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	
	}

}
